home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 5 / CHASSIS_ / DRAWUSER.C < prev    next >
Text File  |  1992-05-14  |  1KB  |  48 lines

  1. /************************************************************************************/
  2. /*    DrawUserIcon                                                                    */
  3. /*                                                                                    */
  4. /*    This procedure draws a thick-line rounded rectangle in the userItem which        */
  5. /*    has been defined in the same area of the window as the default (item #1)        */
  6. /*    button.  The userItem must be defined large enough to contain the thick-line    */
  7. /*    rounded rectangle.                                                                */
  8. /*                                                                                    */
  9. /*    This procedure gets invoked repeatedly by the Dialog Manager while the dialog    */
  10. /*    is active.                                                                        */
  11. /*                                                                                    */
  12. /*    Note, parameter "itemNo" is the item number of the userItem, not of the default    */
  13. /*    Button.  "itemNo" isn't actually used in this procedure.                        */
  14. /************************************************************************************/
  15.  
  16. #include "MyHeaders.h"
  17.  
  18. pascal void DrawUserIcon(DialogPtr theDialog, short itemNo)
  19. {
  20.     GrafPtr        oldPort;
  21.     PenState    oldPen;
  22.     int            iType;
  23.     Handle        h;
  24.     CIconHandle    cH;
  25.     Rect        box;
  26.  
  27.     GetPort(&oldPort);                            /* preserve current grafport        */
  28.     SetPort(theDialog);                            /* point to dialog grafport            */
  29.  
  30.     GetDItem(theDialog, 4, &iType, &h, &box);    /* get the icon item's info            */
  31.  
  32.     UseResFile (myResRefNum);
  33.     if (useColor)
  34.         {
  35.         cH = GetCIcon (128);
  36.         PlotCIcon (&box, cH);
  37.         }
  38.     else
  39.         {
  40.         h = GetResource ('ICN#', 128);
  41.         PlotIcon (&box, h);
  42.         }
  43.  
  44.     SetPort(oldPort);                            /* restore the current grafport        */
  45.     
  46.     return;
  47. }
  48.